package com.netprovider.user.service.baseinfo.objects;

import java.io.Serializable;
import java.util.Date;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

import com.netprovider.user.service.baseinfo.util.DateConverter;
@SuppressWarnings("restriction")
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlRootElement(name = "User")
@XmlType(propOrder = { "userId", "nickname", "gender","registerDate"})  
public class User implements Serializable {

	private static final long serialVersionUID = 1L;

    @NotNull 
    @Pattern(regexp = "\\d+")  
	private String userId;
	
	@NotNull 
	@Size(min = 1, max = 50) 
	private String nickname;
	
	private String gender;

	private Date registerDate;
	
	public User() {}
	public User(String userId, String nickname, String gender, Date registerDate) {
		this.userId = userId;
		this.nickname = nickname;
		this.gender = gender;
		this.registerDate = registerDate;
	}


	//@XmlElement(name = "userId")
	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}
	//@XmlElement(name = "nickname")
	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	//@XmlElement(name = "gender")
	public String getGender() {
		return gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}
	@XmlJavaTypeAdapter(DateConverter.class)
	public Date getRegisterDate() {
		return registerDate;
	}
	public void setRegisterDate(Date registerDate) {
		this.registerDate = registerDate;
	}
	@Override
	public String toString() {
		return "User [userId=" + userId + ", nickname=" + nickname
				+ ", gender=" + gender + ", registerDate=" + registerDate + "]";
	}

	
}
